package method;

public class isDataSafe {
    public static boolean work(String num) {
        for(int i=0;i<num.length();i++) {
            if(!((num.charAt(i)>='0'&&num.charAt(i)<='9')||(num.charAt(0)=='-'))) {
                System.out.println("输入的数据错误");
                return false;
            }
        }
        if(num.isEmpty()) {
            System.out.println("输入的数据错误");
            return false;
        }
        return true;
    }
}
